package com.example.test.mapper;

import com.example.test.entity.Author;
import com.example.test.entity.VenueGoods;
import org.apache.ibatis.annotations.*;

import java.util.List;
import java.util.Map;

@Mapper
public interface VenueMapper {

    List<Map<String,Object>> venueGoodsList(Map<String,Object> param);

    VenueGoods venueGoodsInfo(Integer id);

    @Insert("insert into venue_goods(platform_id,name,goods_num,issue_id,super_id,author_id,shop_type_id,issue_type_id,cover_pic,abridge_pic,detail,intro,price,issue_num,start_time) " +
            "values (#{platformId},#{name},#{goodsNum},#{issueId},#{superId},#{authorId},#{shopTypeId},#{issueTypeId},#{coverPic},#{abridgePic},#{detail},#{intro},#{price},#{issueNum},#{startTime})")
    @Options(useGeneratedKeys = true, keyProperty = "id", keyColumn = "id")
    int addVenueGoods(VenueGoods venueGoods);

    List<Map<String,Object>> authorList();

    //删除数据(返回删除记录数)
    @Delete("delete from venue_goods where id=#{id}")
    public int delVenueGoods(int id);

    //更新数据
    @Update("update venue_goods set name=#{name} where id=#{id} ")
    public int updateVenueGoods(VenueGoods venueGoods);

}